Function Reference

TraySetState

Sets the state of the tray icon.

TraySetState ( [ flag ] )

 

Parameters

flag [optional]
A combination of the following:
1 = Shows the tray icon (default)
2 = Destroys/Hides the tray icon
4 = Flashes the tray icon
8 = Stops tray icon flashing
16 = Resets the icon to the defaults (no flashing, default tip text)

 

Return Value

Success: Returns 1.
Failure: Returns 0.

 

Remarks

This function overrides the "TrayIconHide"-option and "#NoTrayIcon"-setting.
The normal and pause tray icon are NOT reset by this function!

 

Related

TrayItemSetState, TraySetIcon, TraySetPauseIcon

 

Example


#Include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.

$exititem       = TrayCreateItem("Exit")

TraySetIcon("warning")
TraySetToolTip("SOS")

TraySetState()  ; Show the tray icon

$toggle = 0

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            Sleep(1000)
            If $toggle = 0 Then
                TraySetState()  ; Show the tray icon
                $toggle = 1
            Else
                TraySetState(2) ; Hide the tray icon
                $toggle = 0
            EndIF
        Case $msg = $exititem
            ExitLoop
    EndSelect
       
WEnd

Exit